home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / TECHNICA / COMPUTER / H254.ZIP / IRITSM3S.ZIP / IRITFLTR / DAT2IRIT.DSK (.txt) < prev    next >
Turbo C Context File  |  1991-11-11  |  10KB  |  287 lines

  1. Turbo C Context File 
  2. DAT2IRIT.C
  3. DAT2IRIT.C
  4. DAT2IRIT.C
  5. DAT2IRIT.C
  6. DAT2IRIT.C
  7. DAT2IRIT.C
  8. DAT2IRIT.C
  9. DAT2IRIT.C
  10. DAT2IRIT.C
  11. DAT2IRIT.C
  12. DAT2IRIT.C
  13. DAT2IRIT.C
  14. DAT2IRIT.C
  15. DAT2IRIT.C
  16. DAT2IRIT.C
  17. DAT2IRIT.C
  18. DAT2IRIT.C
  19. DAT2IRIT.C
  20. ESL1.C
  21. WINDOWS.C
  22. *.CFG
  23. UTAH.C
  24. FONTCNTR.C
  25. FONTCNVT.C
  26. UTAH1.C
  27. ..\SM\PROGRAM.H
  28. SHE.C
  29. ..\MISC_LIB\*.H
  30. *.DAT
  31. sans.chr
  32. f:*.*
  33. f:tmp
  34. f:temp
  35. solid1.dat
  36. saddle.dat
  37. wiggle.dat saddle.dat
  38. pawn-crv.dat wiggle.dat saddle.dat
  39. pawn-crv.dat wiggle.dat saddle.dat axes.dat points.dat
  40. VertexStruct *.c
  41. float *.c
  42. double *.c
  43. double *.c *.h
  44.  void *.c 
  45. float *.c *.h
  46. Coord
  47. POINTLIST
  48. double
  49. float
  50. AppPolys
  51. NOGRAPHICS
  52. directory
  53. WasMatch
  54. RealType
  55. FALSE
  56. RealType
  57. AllPolys
  58. SubDir
  59. D:\IRIT\ENGLISH\GANG.C
  60. E:\TEMP\USERINTR.C
  61. E:\TEMP\SHE.H
  62. E:\TEMP\SHE.C
  63. E:\TEMP\REVERSE.C
  64. E:\TEMP\MAKEFILE.TC
  65. E:\TEMP\SHE-PR.C
  66. D:\IRIT\ENGLISH\GANG.C
  67. E:\TEMP\PRINTHEB.C
  68. D:\IRIT\ENGLISH\GANG.C
  69. D:\IRIT\ENGLISH\GANG.C
  70. D:\IRIT\MED\UTAH.C
  71. D:\IRIT\MED\UTAH.C
  72. D:\IRIT\MED\COURSE.C
  73. D:\C\MISC_LIB\IRITPRSR.H
  74. D:\C\IRITFLTR\DAT2IRIT.C
  75. D:\C\IRITFLTR\IRIT2RAY.C
  76. --------------------- CUT HERE -----------------------------------------
  77.                             VGA.H
  78. */                            
  79. typedef struct {
  80.         unsigned char red,green,blue;
  81.         } p;
  82. #define ESC 0x1B
  83. #define VIDEO_INT 0x10
  84. #define EGA_MODE  0x13
  85. #define TEXT_MODE 0x3
  86. #define VGA640400 0x5E
  87. #define VGA320200 0x13
  88. #define VGA800600 0x58
  89. #ifndef W
  90. extern int W;
  91. extern int RC;
  92. extern int GC;
  93. extern int BC;
  94. extern int H;
  95. extern int XSIZE,YSIZE;       /* number of pixels in x and y direction */
  96. extern int MAX_COLOR,NUM_COLORS;   /* max color value and maxcolor value +1 */
  97. extern int __current_mode__;
  98. extern p palette[256];
  99. #endif
  100. /* proto types */
  101. void vga_dot(int x, int y, int color);
  102. void vga_mode(int mode);
  103. void text_mode(void);
  104. void set_vga_palette(p *palette);
  105. void set_vga_pal(int index, int red, int green, int blue);
  106. void rainbow_palette(void);
  107. (const void *, const void *)
  108. int(*fcmp)
  109. static void DrawOnePolygon(PolygonStruct *PPolygon)
  110.     int    i, j, Count, DrawNextEdge, NumOfVertices;
  111.     float MappedNormal[3], PolyNormal[3];
  112.     VertexStruct
  113.     *VList = PPolygon -> PVertex,
  114.     *VHead = VList;
  115.     if (VList == NULL) return;
  116.     TestQuitView();
  117.     switch (PPolygon -> Type) {
  118.     case POINTLIST:
  119.         MyMoveTo(VList -> Coord);
  120.         MyDrawTo(VList -> Coord);
  121.         VList = VList -> Pnext;
  122.         for (i = 0;
  123.          i < GlblNumEdges && VList != NULL && VList != VHead;
  124.          i++) {
  125.         MyMoveTo(VList -> Coord);
  126.         MyDrawTo(VList -> Coord);
  127.         VList = VList -> Pnext;
  128.         }
  129.         break;
  130.     case POLYLINE:
  131.         MyMoveTo(VList -> Coord);
  132.         DrawNextEdge = !VList -> Internal;
  133.         VList = VList -> Pnext;
  134.         for (i = 1;
  135.          i < GlblNumEdges && VList != NULL && VList != VHead;
  136.          i++) {
  137.         if (DrawNextEdge || GlblInternal)
  138.             MyDrawTo(VList -> Coord);
  139.         else
  140.             MyMoveTo(VList -> Coord);
  141.         DrawNextEdge = !VList -> Internal;
  142.         VList = VList -> Pnext;
  143.         }
  144.         break;
  145.     case POLYGON:
  146. #ifdef __GL__
  147.         if (GlblDrawSolid) {
  148.         GGMyDrawPolygonSolid(PPolygon);
  149.         break;
  150.         }
  151. #endif
  152.         if (GlblDrawPNormal && PPolygon -> HasPlane) {
  153.         /* Sum all points to be averaged for normal position. */
  154.         for (i = 0; i < 3; i++) PolyNormal[i] = VList -> Coord[i];
  155.         NumOfVertices = 1;
  156.         }
  157.         MyMoveTo(PList -> Coord);
  158.         DrawNextEdge = !PList -> Internal;
  159.         VList = VList -> Pnext;
  160.         for (i = 1;
  161.          i < GlblNumEdges && VList != NULL && VList != VHead;
  162.          i++) {
  163.         if (DrawNextEdge || GlblInternal)
  164.             MyDrawTo(PList[i].Coord);
  165.         else
  166.             MyMoveTo(PList[i].Coord);
  167.         if (GlblDrawVNormal && PList[i].HasNormal) {
  168.             for (j = 0; j < 3; j++) MappedNormal[j] =
  169.                     VList -> Coord[j] + VList -> Normal[j];
  170.             j = GlblClosedObject;
  171.             GlblClosedObject = FALSE;
  172.             MyDrawTo(MappedNormal);
  173.             MyMoveTo(VList -> Coord);
  174.             GlblClosedObject = j;
  175.         if (GlblDrawPNormal && PPolygon -> HasPlane) {
  176.             for (j = 0; j < 3; j++) PolyNormal[j] += VList -> Coord[j];
  177.             NumOfVertices++;
  178.         DrawNextEdge = !VList -> Internal;
  179.         VList = VList -> Pnext;
  180.         }
  181.         if (GlblNumEdges > i) {
  182.         /* Close polygon by drawing a line to first vertex. */
  183.         if (DrawNextEdge || GlblInternal)
  184.             MyDrawTo(VHead -> Coord);
  185.         else
  186.             MyMoveTo(VHead -> Coord);
  187.         if (GlblDrawVNormal && PList[0].HasNormal) {
  188.             for (j = 0; j < 3; j++) MappedNormal[j] =
  189.                     VList -> Coord[j] + VList -> Normal[j];
  190.             j = GlblClosedObject;
  191.             GlblClosedObject = FALSE;
  192.             MyDrawTo(MappedNormal);
  193.             MyMoveTo(VList -> Coord);
  194.             GlblClosedObject = j;
  195.         }
  196.         if (GlblDrawPNormal && PPolygon -> HasPlane) {
  197.         for (i = 0; i < 3; i++) PolyNormal[i] /= NumOfVertices;
  198.         MyMoveTo(PolyNormal);
  199.         for (i = 0; i < 3; i++) PolyNormal[i] += PPolygon -> Plane[i];
  200.         i = GlblClosedObject;
  201.         GlblClosedObject = FALSE;
  202.         MyDrawTo(PolyNormal);
  203.         GlblClosedObject = i;
  204.         }
  205.         break;
  206.     }
  207. /*****************************************************************************
  208. * Routine to draw one polygon, using global Matrix transform Mat.         *
  209. * Note this is the routine that    makes the real drawing...             *
  210. *****************************************************************************/
  211. static double LastCoord[3];    /* Used to store last point we moved/draw to. */
  212.         GGPutMsgXY(InteractMenu.SubWindows[i].Str,
  213.                InteractMenu.SubWindows[i].X -
  214.                 INTERACT_SUB_WINDOW_WIDTH - 0.025,
  215.                InteractMenu.SubWindows[i].Y);
  216. #ifdef VoidPtr
  217. #undef VoidPtr
  218. #endif /* VoidPtr */
  219. #ifdef NO_VOID_PTR
  220. #define VoidPtr        char *
  221. #else
  222. #define VoidPtr        void *
  223. #endif /* NO_VOID_PTR */
  224. #define SIGN(x)        ((x) > 0 ? 1 : ((x) < 0 ? -1 : 0))
  225. void VecCrossProd(VectorType Vres, VectorType V1, VectorType V2)
  226.     VectorType Vtemp;
  227.     Vtemp[0] = V1[1] * V2[2] - V2[1] * V1[2];
  228.     Vtemp[1] = V1[2] * V2[0] - V2[2] * V1[0];
  229.     Vtemp[2] = V1[0] * V2[1] - V2[0] * V1[1];
  230.     VecCopy(Vres, Vtemp);
  231. #ifdef __MSDOS__
  232. typedef    float        RealType;        /* On IBMPC to reserve memory... */
  233. #else
  234. #define DOUBLE
  235. typedef    double        RealType;
  236. #endif /* __MSDOS__ */
  237.     IP_ERR_CAGD_LIB_ERR,
  238. #define CAGD_MESH_UV(Srf, i, j)    ((i) + (Srf -> ULength) * (j))
  239. typedef struct CagdSrfStruct {
  240.     struct CagdSrfStruct *Pnext;
  241.     CagdGeomType GType;
  242.     CagdPointType PType;
  243.     int ULength, VLength;     /* Mesh size in the tensor product surface. */
  244.     int UOrder, VOrder;   /* Order in tensor product surface (Bspline only). */
  245.     CagdRType *Points[CAGD_MAX_PT_SIZE];     /* Pointer on each axis vector. */
  246.     CagdRType *UKnotVector, *VKnotVector;
  247. } CagdSrfStruct;
  248. GGScreenErrorCode
  249. ;If TRUE (default) generates graphics. Otherwise only generates geometry
  250. ; but it can not be displayed.
  251. DoGraphics    TRUE
  252.     if (!GGDoGraphics) return;
  253. #include "utils.h"
  254. MakeBGIFont
  255. #ifdef VoidPtr
  256. #undef VoidPtr
  257. #endif /* VoidPtr */
  258. #ifdef NO_VOID_PTR
  259. #define VoidPtr        char *
  260. #else
  261. #define VoidPtr        void *
  262. #endif /* NO_VOID_PTR */
  263. #if !defined(FLOAT) && !defined(DOUBLE)
  264. #ifdef __MSDOS__
  265. #define FLOAT
  266. typedef    float        RealType;        /* On IBMPC to reserve memory... */
  267. #else
  268. #define DOUBLE
  269. typedef    double        RealType;
  270. #endif /* __MSDOS__ */
  271. #endif /* !FLOAT && !DOUBLE */
  272. #define CR    0x0d
  273. #define LF    0x0a
  274. #define TAB    0x08
  275.     *PObjHead = NULL;
  276. static void DumpOneSurface(FILE *f, CagdSrfStruct *Srf)
  277. static void DumpCtlPt(FILE *f, CagdPointType PType, RealType **Points,
  278. /*****************************************************************************
  279. * Routine to convert all surfaces/curves into polylines as follows:         *
  280. * Curves are converted to single polyline with SamplesPerCurve samples.         *
  281. * Surface are converted into GlblNumOfIsolines curves in each axes, each     *
  282. * handled as Curves above. The curves and surfaces are then deleted.         *
  283. *****************************************************************************/
  284. IPObjectStruct *IritPrsrProcessFreeForm(IPObjectStruct *CrvObjs,
  285.                     IPObjectStruct *SrfObjs)
  286. static void DumpOneSurface(FILE *f, char *Name, CagdSrfStruct *Srf)
  287.